package com.xbang.core.struts.support;

import java.util.Map;

import org.apache.log4j.Logger;

import com.xbang.attendance.entity.role.User;
import com.xbang.attendance.security.support.SecurityUserHolder;
import com.opensymphony.xwork2.ActionSupport;

public class BaseActionSupport extends ActionSupport {
	
	public final Logger logger = Logger.getLogger(getClass());
	private static final long serialVersionUID = -7302637986050349046L;

	private Map<String, Object> errorStack;
	
	protected Integer currPageId = -1 ;
	
	private String infoMessage;

	private String errorMessage;

	public void reSetMessage() {
		if (errorStack != null)
			errorStack.clear();
		setErrorMessage(null);
		setInfoMessage(null);
	}

	/**
	 * @return the infoMessage
	 */
	public String getInfoMessage() {
		return infoMessage;
	}

	/**
	 * @param infoMessage
	 *            the infoMessage to set
	 */
	public void setInfoMessage(String infoMessage) {
		this.infoMessage = infoMessage;
	}

	/**
	 * @return the errorMessage
	 */
	public String getErrorMessage() {
		return errorMessage;
	}

	/**
	 * @param errorMessage
	 *            the errorMessage to set
	 */
	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}

	/**
	 * @return the errorStack
	 */
	public Map<String, Object> getErrorStack() {
		return errorStack;
	}

	/**
	 * @param errorStack
	 *            the errorStack to set
	 */
	public void setErrorStack(Map<String, Object> errorStack) {
		this.errorStack = errorStack;
	}

	/**
	 * 
	 * @return
	 */
	public User getCurrentUser() {
		return SecurityUserHolder.getCurrentUser();
	}

	/**
	 * @return the currPageId
	 */
	public Integer getCurrPageId() {
		return currPageId;
	}

	/**
	 * @param currPageId the currPageId to set
	 */
	public void setCurrPageId(Integer currPageId) {
		this.currPageId = currPageId;
	}
	
	
}
